package io.e2x.testground.fruitstore.dal.entities;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;
import org.springframework.data.relational.core.mapping.Table;

import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * 商品库存
 * @author: sukimiya
 * @date: 2020/5/27 16:01
 */
@Table("SKU")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Sku {
    @Id
    private long id;
    /**
     * 商品名称
     */
    private String name;
    /**
     * 店铺ID
     */
    private long storeId;
    /**
     * 价格
     */
    private BigDecimal price;
    /**
     * 库存
     */
    private Integer stock;
    /**
     * 商品销量
     */
    private Integer count;

    /**
     * 版本, 通过版本锁解决并发问题
     */
    @Version
    private Long version;
    public Sku(String n, long id, BigDecimal i, int i1, int i2) {
        this.name = n;
        this.storeId = id;
        this.price = i;
        this.stock = i1;
        this.count = i2;

    }
}
